@extends('wap.layouts.master')
@section('title','完善资料')

@section('content')

<div class="aw-main aw-common-user aw-user-info">
	<!--表单-开始-->
	<ul class="aw-assest-form aw-bg-fff aw-mt30">
		<li class="aw-form-li aw-user-info-img">
			<div class="aw-left">头像</div>
			<div class="aw-conter aw-pr20">
				<img :src="form.img ? form.img : '/img/default_160_160.png'" onerror="javascript:this.src='/img/default_160_160.png';">
				<input type="file" name="upfile" id="file_img" v-on:click="Click_UpImg('img')">
				<input type="text" id="img" v-model="form.img" :value="form.img" class="aw-hide" placeholder="请上传图片">
			</div>
			<div class="aw-icon aw-icon-more aw-right"></div>
		</li>
		<li class="aw-form-li">
			<div class="aw-left">昵称</div>
			<div class="aw-conter">
				<input type="text" placeholder="请输入昵称" id="nickname" name="nickname" v-model="form.nickname" :value="form.nickname">
			</div>
		</li>
		<li class="aw-form-li">
			<div class="aw-left">生日</div>
			<div class="aw-conter aw-pr20">
				<input type="text" placeholder="请选择生日" id="birthday" name="birthday" v-model="form.birthday" :value="form.birthday" readonly="readonly">
			</div>
			<div class="aw-icon aw-icon-more aw-right"></div>
		</li>
	</ul>
	<div class="aw-common-btn aw-mt20"><a v-on:click="Click_Save()" href="javascript:;" class="aw-assest-btn aw-btn-radius aw-btn-bgcolor-lvse">完成</a></div>
	<!--表单-结束-->
</div>

@section('pagejs')
@parent
<!--手机端日期插件-->
<link href="/wap/js/mobiscroll/mobiscroll.css" rel="stylesheet" type="text/css">
<link href="/wap/js/mobiscroll/mobiscroll_color.css" rel="stylesheet" type="text/css">
<link href="/wap/js/mobiscroll/mobiscroll_android.css" rel="stylesheet" type="text/css">
<script src="/wap/js/mobiscroll/mobiscroll_base.js" type="text/javascript"></script>
<script src="/wap/js/mobiscroll/mobiscroll_cn.js" type="text/javascript"></script>
<script src="/wap/js/mobiscroll/mobiscroll.js" type="text/javascript"></script>
<!--图片上传-->
<script type="text/javascript" src="/library/jquery-file-upload/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="/library/jquery-file-upload/js/jquery.fileupload.js"></script>
<style>
.dwbc-p .dwbw{width: 33.33%;}
.android-ics .dw .dwb-a{background:#1BC96C !important;}
</style>
<script type="text/javascript">
var MJS_User_Info=GBC_User_Info;
vm=new Vue({
	el:'#Vue-body',
	data:{
		form:{nickname:MJS_User_Info.nickname,img:MJS_User_Info.img,birthday:MJS_User_Info.birthday,},
	},methods:{
		Click_UpImg:function(name){
			Img_Upload(name,function(This,name,url){
				vm.form.img=url;
			})
		},Click_Save:function(){
			var AD_info={
				api:'/api/user/user-save',
				form_data:this.form,
				tips:'资料完善成功',
			}
			Form_Verification('#Vue-body',AD_info.form_data,'birthday',function(ver_code){
				if(ver_code==1){
					postData(AD_info,function(){
						//获取用户详情存进缓存
						Get_User_Info(MJS_User_Info.id,'/wap/user/index')
					})
				}
			})
		}
	}
})
$(function(){
	var currYear = (new Date()).getFullYear();	
	var opt={};
	opt.date = {preset : 'date'};
	opt.datetime = {preset : 'datetime'};
	opt.time = {preset : 'time'};
	opt.default = {
		theme: 'android-ics light', //皮肤样式
	    display: 'modal', //显示方式 
		mode: 'scroller', //日期选择模式
		dateFormat: 'yyyy-mm-dd',
		lang: 'zh',
		showNow: true,
		nowText: "今天",
        startYear: currYear - 50, //开始年份
        endYear: currYear, //结束年份
        onSelect:function(valueText,inst){
	  		vm.form.birthday = valueText;
	  	}
	};
  	$("#birthday").mobiscroll($.extend(opt['date'], opt['default']));
});
$(document).on('click','#birthday',function(){
	$(this).blur()
})
</script>
@endsection

@endsection

